home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0174_Tabbed List Box Component.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-30  |  957 b   |  47 lines

  1. unit ListboxT;
  2.  
  3. interface
  4.  
  5. Uses Forms, Controls, StdCtrls;
  6.  
  7. Type
  8.   TListBoxTabs = Class (TListBox)
  9.     public
  10.       procedure CreateParams (var Params: TCreateParams); override;
  11.       Procedure SetTabStops (Val: Array of Cardinal);
  12.       { Remember - tabstops are in dialog units, which is approx
  13.         1/4 the width of an average character }
  14.     end;
  15.  
  16. Procedure Register;
  17.  
  18. implementation
  19.  
  20. Uses
  21.   {$IFDEF Win32}
  22.   Windows,
  23.   {$ELSE}
  24.   WinTypes, WinProcs,
  25.   {$ENDIF}
  26.   Classes, Messages;
  27.  
  28. procedure TListBoxTabs.CreateParams (var Params: TCreateParams);
  29. begin
  30.   inherited CreateParams (Params);
  31.   with Params do
  32.     Style := Style or lbs_UseTabStops;
  33.   end;
  34.  
  35. procedure TListBoxTabs.SetTabStops (Val: Array of Cardinal);
  36. begin
  37.   SendMessage (Handle, lb_SetTabStops, High (Val) - Low (Val) + 1, LongInt (@Val));
  38.   end;
  39.  
  40.  
  41. Procedure Register;
  42. begin
  43.   RegisterComponents ('My Stuff', [TListboxTabs]);
  44.   end;
  45.  
  46. end.
  47.